package com.example.demo._config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.example.demo.intercepter.AuthIntercepter;


@Component
public class Configuration implements WebMvcConfigurer {

    @Autowired
    private AuthIntercepter authIntercepter;

    /**
     * 重写添加拦截器方法并添加配置拦截器
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authIntercepter).addPathPatterns("/**")
                .excludePathPatterns("/plugins/**", "/jquery_form/**",  "/css/**", "/**/*.font",
                		"/js/**", "/img/**", "/token", "/client/**");

    }
}
